<?php
$sql = "select po.products_options_id,po.products_options_name,pov.products_options_values_id,pov.products_options_values_name,pot.products_options_types_name from " . TABLE_PRODUCTS_OPTIONS . " po " . 
	   "join ". TABLE_PRODUCTS_OPTIONS_VALUES_TO_PRODUCTS_OPTIONS." pov_po on pov_po.products_options_id=po.products_options_id ".
	   "join ". TABLE_PRODUCTS_OPTIONS_VALUES." pov on pov.products_options_values_id=pov_po.products_options_values_id ".
	   "join ". TABLE_PRODUCTS_OPTIONS_TYPES." pot on pot.products_options_types_id=po.products_options_type ".
	   "where pot.products_options_types_name IN('Dropdown','Radio','Checkbox','下拉','单选','多选') and po.language_id=".(int)$_SESSION['languages_id']." ".
	   "and pov.language_id=".(int)$_SESSION['languages_id']." ".
	   "order by po.products_options_sort_order,pov.products_options_values_sort_order";
$r = $db->Execute($sql);
$options = array();
if ($r->RecordCount()>0){
	while (!$r->EOF){
		$options[$r->fields['products_options_id']][$r->fields['products_options_values_id']] = array('products_options_name'=>$r->fields['products_options_name'],'products_options_values_name'=>$r->fields['products_options_values_name'],'products_options_types_name'=>$r->fields['products_options_types_name']);
		$r->MoveNext();
	}
}
require($template->get_template_dir('tpl_products_options.php', DIR_WS_TEMPLATE, $current_page_base,'sideboxes') . '/tpl_products_options.php');